import React, { FC, createContext, useReducer } from "react"
import List from "./list."
import InputForm from "./inputForm"
import reducer from "./reducer"
import initialState from "./store"

export const TodoContext = createContext({})

const ReducerDemo: FC = () => {
  const [state, dispatch] = useReducer(reducer, initialState)
  return (
    <TodoContext.Provider value={state, dispatch)}>
      <p>Todo list by useReducer</p>
      <List></List>
      <InputForm></InputForm>
    </TodoContext.Provider>
  )
}

export default ReducerDemo
